package text;
import java.util.Scanner;
public class Test {
	  public void menu1() {
	        System.out.println("欢迎使用选课模拟系统！" + "\n" + "菜单：" + "\n" + "1.教师登录" + "\n" + "2.学生登录" + "\n" + "请输入1或2选择登陆方式");
	    }

	    public void menu2() {
	        System.out.println("欢迎使用选课系统" + "\n" + "菜单：" + "\n" + "1.选课操作" + "\n" + "2.退课操作" + "\n" + "请输入1或2选择操作类型");
	    }

	    public void reportError() {
	        System.out.println("您的输入有误，程序已终止");
	    }

	    public void fengexian() {
	        for (int i = 1; i <= 10; i++) {
	            System.out.print("-----");
	        }
	        ;
	        System.out.println();
	    }

	    public static void main(String[] args) {
	        Test TS = new Test();
	        Scanner input = new Scanner(System.in);
	        Curriculums 高等数学 = new Curriculums(1, "高等数学", "综0101", "9:00");
	        Curriculums  大物= new Curriculums(2, "大物", "综0106", "13:15");
	        Curriculums java = new Curriculums(3, "java", "综0201", "14:20");
	        Curriculums 英语 = new Curriculums(4, "英语", "综0202", "15:10");
	        Curriculums 模电 = new Curriculums(5, "模电", "综0203", "16:30");
	        Curriculums 马原 = new Curriculums(6, "马原", "综0204", "17:30");
	        Curriculums moren1[] = new Curriculums[6];
	        Curriculums moren2[] = new Curriculums[6];
	        Teachers 王老师 = new Teachers(1, "王老师", "男", moren1);
	        Students 小刘 = new Students(1, "小刘", "男", moren2);
	        int x = 0;
	        while (true) {
	            TS.fengexian();
	            if (x == 0) {
	                System.out.println("欢迎使用学生选课系统" + "\n" + "还未有教师开设课程，本次默认为开课操作" + "\n" + "正在进行开课操作!");
	                TS.fengexian();
	                System.out.println("可开课程为:" + "\n" + 高等数学.curriculumsname + "\n" + 大物.curriculumsname + "\n"
	                        + java.curriculumsname + "\n" + 英语.curriculumsname + "\n" + 模电.curriculumsname + "\n"
	                        + 马原.curriculumsname + "以上次序依次为0~5");
	                TS.fengexian();
	                System.out.println("请输入所开设课程");
	                int z = input.nextInt();
	                Curriculums moren[] = { 高等数学, 大物, java, 英语, 模电, 马原 };
	                王老师.openCurriculums(王老师, z, moren[z]);
	                moren[z].curriculumsTeacher = "王老师";
	                TS.fengexian();
	                System.out.println("是否继续进行操作?" + "\n" + "1.继续" + "\n" + "2.结束");
	                TS.fengexian();
	                x = input.nextInt();
	                if (x == 1) {
	                    continue;
	                }
	                TS.fengexian();
	                break;
	            } else {
	                TS.menu1();
	                TS.fengexian();
	                x = input.nextInt();
	                if (x == 1) {
	                    System.out.println("正在进行开课操作!");
	                    TS.fengexian();
	                    System.out.println("可开课程为:" + "\n" + 高等数学.curriculumsname + "\n" + 大物.curriculumsname + "\n"
	                            + java.curriculumsname + "\n" + 英语.curriculumsname + "\n" + 模电.curriculumsname
	                            + "\n" + 马原.curriculumsname + "以上次序依次为0~5");
	                    TS.fengexian();
	                    System.out.println("请输入所开设课程");
	                    int z = input.nextInt();
	                    Curriculums moren[] = { 高等数学, 大物, java, 英语, 模电, 马原  };
	                    王老师.openCurriculums(王老师, z, moren[z]);
	                    moren[z].curriculumsTeacher = "王老师";
	                } else if (x == 2) {
	                    TS.fengexian();
	                    TS.menu2();
	                    TS.fengexian();
	                    int s = input.nextInt();
	                    if (s == 1) {
	                        TS.fengexian();
	                        System.out.println("正在进行选课操作!");
	                        TS.fengexian();
	                        System.out.println("可开课程为:" + "\n" + 高等数学.curriculumsname + "\n" + 大物.curriculumsname + "\n"
	                                + java.curriculumsname + "\n" + 英语.curriculumsname + "\n" + 模电.curriculumsname
	                                + "\n" + 马原.curriculumsname + "以上次序依次为0~5");
	                        TS.fengexian();
	                        Curriculums moren[] = { 高等数学, 大物, java, 英语, 模电, 马原 };
	                        int j = input.nextInt();
	                        小刘.choiceCurriculums(小刘, j, moren[j]);
	                    } else if (s == 2) {
	                    	System.out.println("正在进行退课操作!");
	                        TS.fengexian();
	                        int p = input.nextInt();
	                        小刘.outCurriculums(小刘, p);
	                    } else {
	                        TS.fengexian();
	                        TS.reportError();
	                        TS.fengexian();
	                        break;
	                    }
	                    TS.fengexian();
	                    System.out.println("本次选课已结束，正在打印学生选课信息");
	                    System.out.println("学生姓名:" + 小刘.name + "\n" + "所选课程:" + "\n");
	                    for (int i = 0; i < 6; i++) {
	                        if (小刘.curriculums[i] == null) {
	                            continue;
	                        }
	                        System.out.print(小刘.curriculums[i].number + "丨" + 小刘.curriculums[i].curriculumsname
	                                + "丨" + 小刘.curriculums[i].place + "丨" + 小刘.curriculums[i].Classtime + "丨"
	                                + 小刘.curriculums[i].curriculumsTeacher + "\n");
	                    }
	                    TS.fengexian();
	                } else {
	                    TS.fengexian();
	                    TS.reportError();
	                    TS.fengexian();
	                    break;
	                }
	            }
	            ;
	            System.out.println("是否继续进行操作?" + "\n" + "1.继续" + "\n" + "2.结束");
	            TS.fengexian();
	            int y = input.nextInt();
	            if (y == 1) {
	                continue;
	            } else if (y == 2)
	                break;
	            else {
	                TS.fengexian();
	                TS.reportError();
	                TS.fengexian();
	                break;
	            }
	        }
	        input.close();
	    }
}
